package net.wofly.right.util;

/**
 * 用户注册类型
 *
 * @author lign
 * @version 1.0
 * @created 20-9月-2017 20:20:25
 */
public enum RegisterWay {
    手机号注册(1, "手机号注册"),
    邮箱注册(2, "邮箱注册"),
    微信登陆(3, "微信登陆"),
    QQ登陆(4, "QQ登陆");
    
    private Integer value;
    private String name;
    
    private RegisterWay(Integer value, String name) {
        this.value = value;
        this.name = name;
    }
    
    public static boolean isValueCorrect(Integer value) {
        for (RegisterWay forEnum : values()) {
            if (value == forEnum.getValue()) {
                return true;
            }
        }
        return false;
    }
    
    public static String getName(Integer value) {
        for (RegisterWay forEnum : values()) {
            if (value.equals(forEnum.getValue())) {
                return forEnum.name;
            }
        }
        return null;
    }
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public Integer getValue() {
        return value;
    }
    
    public void setValue(Integer value) {
        this.value = value;
    }
}